package demo.sort;

import java.util.Arrays;
import java.util.Random;

/**
 * @Author: admin
 * @Description:
 * @Date: Create in 2021/6/13-18:44
 */
public class CheckData {

    public static int[] generationRandomArray() {
        Random random = new Random();
        int[] arr = new int[100000];
        for (int i = 0; i < arr.length; i++) {
            arr[i] = random.nextInt(100000);
        }
        return arr;
    }

    public static void main(String[] args) {
        int[] arr = generationRandomArray();
        int[] arr1 = Arrays.copyOf(arr,arr.length);



        long start = System.currentTimeMillis();

        QuickSort.quickSort(arr,0,arr.length-1);
        System.out.println(System.currentTimeMillis()-start);

        start = System.currentTimeMillis();
        Arrays.sort(arr1);
        System.out.println(System.currentTimeMillis()-start);



        boolean same = true;
        for (int i = 0; i < arr.length; i++) {
            if (arr[i] != arr1[i]) {
                same = false;
            }
        }
        System.out.println(same);
    }
}
